package com.eos.control.action.activity;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysCombo;
import com.eos.orm.mybatis.model.SysUser;

public class DeleteSetMealAction extends AbstractBaseAction {
	private static final long serialVersionUID = -8710498036583335340L;
    private Integer setMealId;
	
    public void setSetMealId(Integer setMealId) {
		this.setMealId = setMealId;
	}

	@Override
	public String execute() {
		try {
			if(setMealId == null || setMealId.intValue()<=0){
				statusCode = "300";
				message = "参数错误, 删除套餐失败!";
			}else{
				SysUser user = (SysUser)getSession().getAttribute("SysUser");
				String userId = user.getId()+"";
				SysActivityBusinessService sabs = new SysActivityBusinessService();
				SysCombo combo = new SysCombo();
				combo.setId(setMealId);
				combo.setDealFlag(ConstantTool.DEAL_FLAG_FAIL);
				combo.setUpdateUserId(userId);
				combo.setModifyTime(ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss"));
				String exeStatus = sabs.updateSysComboPKSelective(combo);
				if("SUCCESS".equals(exeStatus)){
					statusCode = "200";
					message = "删除套餐信息成功!";
				}else{
					statusCode = "300";
					message = "系统繁忙, 删除套餐信息失败!";
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			statusCode = "300";
			message = "系统异常, 删除套餐信息失败!";
		}
		return SUCCESS;
	}
}
